#!/bin/sh
. /etc/init.d/functions
VIP=(
192.168.100.10
192.168.100.11
)
start () {
for ((i=0;i<${#VIP[*]};i++))
do
ifconfig lo:$i ${VIP[$i]}/32 up
route add -host ${VIP[$i]} eth0
done
echo 1 >/proc/sys/net/ipv4/conf/lo/arp_ignore 
echo 2 >/proc/sys/net/ipv4/conf/lo/arp_announce
echo 1 >/proc/sys/net/ipv4/conf/all/arp_ignore 
echo 2 >/proc/sys/net/ipv4/conf/all/arp_announce
}
stop () {
for ((i=0;i<${#VIP[*]};i++))
do
ifconfig lo:$i ${VIP[$i]}/32 down
route del -host ${VIP[$i]} eth0
done
echo 0 >/proc/sys/net/ipv4/conf/lo/arp_ignore 
echo 0 >/proc/sys/net/ipv4/conf/lo/arp_announce
echo 0 >/proc/sys/net/ipv4/conf/all/arp_ignore 
echo 0 >/proc/sys/net/ipv4/conf/all/arp_announce
}
case "$1" in
        start)
        start
        action "RS is starting" /bin/true
        ;;
        stop)
        stop
        action "RS is stoping" /bin/true
        ;;
        *)
        echo "Usage:$0 [start|stop]"
esac
